# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: HurricanePootis <hurricanepootis@protonmail.com>
# Contributor: Spike29 <leguen.yannick@gmail.com>
# Contributor: Samir Faci <csgeek@archlinux.us>
# Contributor: TimothÃ©e Ravier <tim@siosm.fr>

pkgbase=qxmpp
pkgname=(qxmpp-qt5 qxmpp-qt6)
pkgver=1.5.5
pkgrel=1
pkgdesc='Cross-platform C++ XMPP client and server library'
arch=(loong64 x86_64)
url='https://github.com/qxmpp-project/qxmpp'
license=(LGPL2.1)
depends=(gstreamer)
makedepends=(cmake qca-qt5 qca-qt6 libomemo-c)
optdepends=('libomemo-c: OMEMO support')
source=(https://github.com/qxmpp-project/qxmpp/archive/v$pkgver/$pkgbase-$pkgver.tar.gz)
sha256sums=('b25fba89432c4fd72489d1844f683bfbf4e5aa4cfcfda7a982d6019f8e4529f8')

build() {
  cmake -B build5 -S $pkgbase-$pkgver \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DBUILD_EXAMPLES=OFF \
    -DBUILD_TESTS=OFF \
    -DWITH_GSTREAMER=ON \
    -DBUILD_OMEMO=ON \
    -DQT_VERSION_MAJOR=5
  cmake --build build5
 
  cmake -B build6 -S $pkgbase-$pkgver \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DBUILD_EXAMPLES=OFF \
    -DBUILD_TESTS=OFF \
    -DWITH_GSTREAMER=ON \
    -DBUILD_OMEMO=ON \
    -DQT_VERSION_MAJOR=6
  cmake --build build6
}

package_qxmpp-qt5() {
  depends+=(qca-qt5)
  DESTDIR="$pkgdir" cmake --install build5
}

package_qxmpp-qt6() {
  depends+=(qca-qt6)
  DESTDIR="$pkgdir" cmake --install build6
}
